package com.example.roy;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: xuesong
 * @Date: 2020/10/29 22:05
 * @Description:
 */
@RestController
@RequestMapping("/")
public class IndexController {

    @Value("${name}")
    private String name;

    @Value("${age}")
    private Integer age;

    @GetMapping
    public DataObject hello(){
        return new DataObject(name,age);
    }

    @Data
    public static class DataObject{
        private String name;
        private Integer age;

        public DataObject(String name, Integer age) {
            this.name = name;
            this.age = age;
        }
    }
}
